#include <bits/stdc++.h>
using namespace std;

typedef long long LL;


const int N = 2e5+5;

int mp[N << 2], mp2[N << 2];

int t, n, a[N];
int b[N];


int main(int argc, char const *argv[])
{
    scanf("%d", &t);
    memset(mp, -1, sizeof mp);
    memset(mp2, -1, sizeof mp2);
    for (int kk=0; kk<t; ++kk) {
        scanf("%d", &n);
        for (int i=0; i<n*2; ++i)
            scanf("%d", &a[i]);
        int sum = 0; mp[0 + N] = n;
        vector<int> list1, list2;
        list1.push_back(0);
        for (int i=0; i<n; ++i) {
            if (a[i] == 1) sum++;
            else sum--;
            b[i] = sum;
            mp[sum + N] = n - i - 1;
            list1.push_back(sum);
        }
        mp2[0 + N] = n;
        sum = 0;
        for (int i=n*2-1; i>=n; --i) {
            if (a[i] == 1) sum++;
            else sum--;
            mp2[sum + N] = i-n;
            list2.push_back(sum);
        }
        int ans = mp2[0 + N] + n;

        // for (int i=0; i<n; ++i) {
        //     printf("%d\n", b[i]);
        // }
        // printf("%d\n", b[n-1]); return 0;
        // printf("%d\n", ans); return 0;
        for (int i=0; i<n; ++i) {
            if (~mp2[N - b[i]]) {
                ans = min(ans, n-i-1+mp2[N - b[i]]);
                // printf("%d %d %d\n", i, ans, b[i]);
            }
        }
        printf("%d\n", ans);

        for (int x : list1) mp[x + N] = -1;
        for (int x : list2) mp2[x + N] = -1;
    }
    return 0;
}
